package com.ysstech.reportworld.enums;

import com.ysstech.common.enums.BaseEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;

/**
 * 系统常量
 *
 * @author lsl
 */
@Getter
@AllArgsConstructor
public enum ReportWorldLayeredEnum implements BaseEnum<Integer> {
    LAYERED_ONE(1, "标准层"),
    LAYERED_TWO(2, "集市层"),
    LAYERED_THREE(3, "系统层"),
    LAYERED_FOUR(4, "贴源层"),
    LAYERED_FIVE(5, "中间层"),
    LAYERED_SIX(6, "报表落地表");

    private final Integer code;
    private final String desc;

    public static ReportWorldLayeredEnum getEnum(Integer code) {
        return Arrays.stream(values()).filter(b -> Objects.equals(b.code, code)).findFirst().orElse(null);
    }

    public static String getEnumDesc(Integer code) {
        ReportWorldLayeredEnum e = getEnum(code);
        return e != null ? e.desc : null;
    }
}
